package com.example.springbott.wx_controller;

import com.example.springbott.bean.BaseRespVo;
import com.example.springbott.bean.MarketAftersale;
import com.example.springbott.bean.silic.WXAftersaleDetailsVo;
import com.example.springbott.wx_service.WXAftersaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 申请售后
 *
 * @author silic xia
 * @since 2022/11/23 15:11
 */
@RestController
@RequestMapping("wx/aftersale")
public class WXAftersaleController {

    @Autowired
    WXAftersaleService wxAftersaleService;

    /**
     * 申请售后 details——展示功能
     *
     * @param /orderId=153
     * @return BaseRespVo--aftersale/order/orderGoods
     * @author silic xia
     * @since 2022/11/23 15:12
     */
    @RequestMapping("detail")
    public BaseRespVo wxAftersaleDetails(String orderId) {
        WXAftersaleDetailsVo data = wxAftersaleService.wxAftersaleDetails(orderId);
        return BaseRespVo.ok(data);
    }

    /**
     * 申请售后 submit——提交
     *
     * @param {pictures: [], orderId: "160", amount: 206, type: 0, typeDesc: "未收货退款", reason: "111"}
     * @return {errno: 0, errmsg: "成功"}
     * @author silic xia
     * @since 2022/11/23 15:53
     */
    @RequestMapping("submit")
    public BaseRespVo wxAftersaleSubmit(@RequestBody MarketAftersale marketAftersale){
        wxAftersaleService.wxAftersaleSubmit(marketAftersale);
        return BaseRespVo.ok();
    }
}

